/*
 *
 *  * Copyright (c) 2016. For Intelligent Group.
 *
 */

package com.intelligent.ispc.client.event;

import com.google.common.eventbus.Subscribe;
import com.intelligent.ispc.client.utils.AppMessageFactory;

/**
 * Created by Peter on 2016/10/28.
 */
public class ExceptionCatchListener {

    /**
     * Event subscribe method for catch exceptions.
     *
     * @param event ThrowExceptionEvent instance
     */
    @Subscribe
    private void catchException(ThrowExceptionEvent event) {
        if (event.getCode() != 0) {
            AppMessageFactory.showErrorDialog("[" + event.getCode() + "] " + event.getMessage());
        } else {
            AppMessageFactory.showErrorDialog(event.getMessage());
        }
    }
}
